From: Paul Donald Date: Fri, 11 Apr 2025 13:02:28 +0000 (+0200) Subject: ddns-scripts: drop split_FQDN() X-Git-Url: http://git.openwrt.org/%22https:/collectd.org//%22/%22https:/collectd.org/%22?a=commitdiff_plain;h=38e02fbd578812e39e40706e0f4fa691fed6cbf7;p=feed%2Fpackages.git ddns-scripts: drop split_FQDN() The function is unused - it can be removed. Signed-off-by: Paul Donald --- diff --git a/net/ddns-scripts/files/usr/lib/ddns/dynamic_dns_functions.sh b/net/ddns-scripts/files/usr/lib/ddns/dynamic_dns_functions.sh index 3beb52e98d..79da24be9c 100644 --- a/net/ddns-scripts/files/usr/lib/ddns/dynamic_dns_functions.sh +++ b/net/ddns-scripts/files/usr/lib/ddns/dynamic_dns_functions.sh @@ -37,7 +37,6 @@ UPDFILE="" # store UPTIME of last update DATFILE="" # save stdout data of WGet and other external programs called ERRFILE="" # save stderr output of WGet and other external programs called IPFILE="" # store registered IP for read by LuCI status -TLDFILE=/usr/share/public_suffix_list.dat.gz # TLD file used by split_FQDN CHECK_SECONDS=0 # calculated seconds out of given FORCE_SECONDS=0 # interval and unit @@ -1153,78 +1152,6 @@ trap_handler() { [ $1 -gt 0 ] && kill -$1 $$ } -split_FQDN() { - # $1 FQDN to split - # $2 name of variable to store TLD - # $3 name of variable to store (reg)Domain - # $4 name of variable to store Host/Subdomain - - [ $# -ne 4 ] && write_log 12 "Error calling 'split_FQDN()' - wrong number of parameters" - [ -z "$1" ] && write_log 12 "Error calling 'split_FQDN()' - missing FQDN to split" - [ -f $TLDFILE ] || write_log 12 "Error calling 'split_FQDN()' - missing file '$TLDFILE'" - - local _HOST _FDOM _CTLD _FTLD - local _SET="$@" # save given function parameters - - local _PAR=$(echo "$1" | tr [A-Z] [a-z] | tr "." " ") # to lower and replace DOT with SPACE - set -- $_PAR # set new as function parameters - _PAR="" # clear variable for later reuse - while [ -n "$1" ] ; do # as long we have parameters - _PAR="$1 $_PAR" # invert order of parameters - shift - done - set -- $_PAR # use new as function parameters - _PAR="" # clear variable - - while [ -n "$1" ] ; do # as long we have parameters - if [ -z "$_CTLD" ]; then # first loop - _CTLD="$1" # CURRENT TLD to look at - shift - else - _CTLD="$1.$_CTLD" # Next TLD to look at - shift - fi - # check if TLD exact match in tld_names.dat, save TLD - zcat $TLDFILE | grep -E "^$_CTLD$" >/dev/null 2>&1 && { - _FTLD="$_CTLD" # save found - _FDOM="$1" # save domain next step might be invalid - continue - } - # check if match any "*" in tld_names.dat, - zcat $TLDFILE | grep -E "^\*.$_CTLD$" >/dev/null 2>&1 && { - [ -z "$1" ] && break # no more data break - # check if next level TLD match excludes "!" in tld_names.dat - if zcat $TLDFILE | grep -E "^!$1.$_CTLD$" >/dev/null 2>&1 ; then - _FTLD="$_CTLD" # Yes - else - _FTLD="$1.$_CTLD" - shift - fi - _FDOM="$1"; shift - } - [ -n "$_FTLD" ] && break # we have something valid, break - done - - # the leftover parameters are the HOST/SUBDOMAIN - while [ -n "$1" ]; do - _HOST="$1 $_HOST" # remember we need to invert - shift - done - _HOST=$(echo $_HOST | tr " " ".") # insert DOT - - set -- $_SET # set back parameters from function call - [ -n "$_FTLD" ] && { - eval "$2=$_FTLD" # set TLD - eval "$3=$_FDOM" # set registrable domain - eval "$4=$_HOST" # set HOST/SUBDOMAIN - return 0 - } - eval "$2=''" # clear TLD - eval "$3=''" # clear registrable domain - eval "$4=''" # clear HOST/SUBDOMAIN - return 1 -} - expand_ipv6() { # Original written for bash by #.Author: Florian Streibelt diff --git a/net/ddns-scripts/files/usr/lib/ddns/update_cloudflare_com_v4.sh b/net/ddns-scripts/files/usr/lib/ddns/update_cloudflare_com_v4.sh index 17cd7c0243..28861c7c6e 100644 --- a/net/ddns-scripts/files/usr/lib/ddns/update_cloudflare_com_v4.sh +++ b/net/ddns-scripts/files/usr/lib/ddns/update_cloudflare_com_v4.sh @@ -13,7 +13,7 @@ # using following options from /etc/config/ddns # option username - your cloudflare e-mail # option password - cloudflare api key, you can get it from cloudflare.com/my-account/ -# option domain - "hostname@yourdomain.TLD" # syntax changed to remove split_FQDN() function and tld_names.dat.gz +# option domain - "hostname@yourdomain.TLD" # # The proxy status would not be changed by this script. Please change it in Cloudflare dashboard manually. # diff --git a/net/ddns-scripts/files/usr/lib/ddns/update_huaweicloud_com.sh b/net/ddns-scripts/files/usr/lib/ddns/update_huaweicloud_com.sh index 1ce866cd4d..32c09ed436 100644 --- a/net/ddns-scripts/files/usr/lib/ddns/update_huaweicloud_com.sh +++ b/net/ddns-scripts/files/usr/lib/ddns/update_huaweicloud_com.sh @@ -11,7 +11,7 @@ # using following options from /etc/config/ddns # option username - huaweicloud Access Key Id # option password - huaweicloud Secret Access Key,AK、SK documentation from https://support.huaweicloud.com/devg-apisign/api-sign-provide-aksk.html -# option domain - "hostname@yourdomain.TLD" # syntax changed to remove split_FQDN() function and tld_names.dat.gz +# option domain - "hostname@yourdomain.TLD" # # Check inputs